from enum import Enum


class OrderStateEnum(Enum):
    # 1 待审核，2 待调度，3 审核驳回，4  待确认，5 待开始，6 进行中，7 已完结，8 已取消）
    dsh = 1
    ddd = 2
    shbh = 3
    dqr = 4
    dks = 5
    jxz = 6
    ywj = 7
    yqx = 8

    @staticmethod
    def can_cancel(state: str):
        if state in [OrderStateEnum.dsh.value, OrderStateEnum.ddd.value, OrderStateEnum.dqr.value,
                     OrderStateEnum.dks.value]:
            return True
        else:
            return False

    @staticmethod
    def get_state_name(state: str):
        if state is None:
            return None
        if state == 1:
            return "待审核"
        elif state == 2:
            return "待调度"
        elif state == 3:
            return "审核驳回"
        elif state == 4:
            return "待确认"
        elif state == 5:
            return "待开始"
        elif state == 6:
            return "进行中"
        elif state == 7:
            return "已完结"
        elif state == 8:
            return "已取消"
        else:
            return "退回"


class OrderApproveStateEnum(Enum):
    # 1 审核通过 2审核驳回
    pass1 = 1
    refuse = 2


class OrderDispatchStateEnum(Enum):
    # 1未确认 2已确认 3退回
    not_confirm = 1
    confirm = 2
    refuse = 3

    @staticmethod
    def get_state_name(state: str):
        if state is None:
            return None
        if state == 1:
            return "未确认"
        elif state == 2:
            return "已确认"
        else:
            return "退回"
